<style lang="less">
    @import "../carDealer.less";
    .s1{
        .ivu-select-dropdown-list {
            height:200px;
        }
    }
</style>
<template>
    <div class="search">
        <Row>
            <Col>
                <Card>
                    <Row>
                        <Form ref="searchForm" :model="searchForm" inline :label-width="110" class="search-form"  :rules="formValidate">

                            <Row>
                                <Form-item label="车商名称" prop="cardealerName" style="widtht: 350px" >
                                    <Select v-model="searchForm.cardealerName" clearable filterable placeholder="请选择" style="width: 200px" class="s1">
                                        <Option v-for="(item) in cardealerNameData" :value="item" :label="item"  :key="item.index"></Option>
                                    </Select>
                                </Form-item>

                                <Form-item label="法人名称" prop="corporateName" style="widtht: 350px">
                                    <Input type="text" v-model.trim="searchForm.corporateName" clearable placeholder="请输入"
                                           style="width: 200px;" />
                                </Form-item>

                                <Form-item label="合作商名称" prop="channelFullName" >
                                    <Input type="text" v-model.trim="searchForm.channelFullName"  placeholder="请输入"
                                           style="width: 200px"/>
                                    <a class="drop-down" @click="dropDown" > {{dropDownContent}}
                                        <Icon :type="dropDownIcon"></Icon>
                                    </a>
                                </Form-item>
                            </Row>

                            <Row>
                                <span v-if="drop" >
                                <Form-item label="渠道归属" prop="channelBelong" style="widtht: 350px">
                                    <Select v-model="searchForm.channelBelong" placeholder="请选择" clearable  style="width: 200px;height: 52px">
                                        <Option value="00">SP</Option>
                                        <Option value="01">直营</Option>
                                        <Option value="02">总对总</Option>
                                    </Select>
                                </Form-item>

                                <Form-item label="业务员" prop="salesMan" style="widtht: 350px">
                                    <Input type="text" v-model.trim="searchForm.salesMan" clearable placeholder="请输入"
                                           style="width: 200px"/>
                                </Form-item>

                                    <Form-item label="状态" prop="status" style="widtht: 350px">
                                    <Select v-model="searchForm.status" placeholder="请选择" clearable  style="width: 200px;height: 52px">
                                        <Option value="00">启用</Option>
                                        <Option value="01">审核中</Option>
                                        <Option value="02">草稿</Option>
                                        <Option value="03">退回</Option>
                                        <Option value="04">拒绝</Option>
                                        <Option value="05">停用</Option>
                                    </Select>
                                </Form-item>
                            </span>
                            </Row>
                        </Form>

                        <Form :label-width="490" >

                                <Form-item style="margin-left:-35px;" class="br">
                                    <Button @click="handleSearch" type="primary" icon="ios-search">查询</Button>
                                    <Button @click="handleReset" icon="md-redo">重置</Button>

                            </Form-item>
                        </Form>
                        <!--批量修改业务员-->
                        <Modal title="请选择修改后的业务员" v-model="modal1" :mask-closable='false' :width="300" :styles="{top: '100px'}">
                            <Select  placeholder="请选择" filterable v-model="editForm.salesMan" class="s1" >
                                <Option v-for="(item,index) in salesManData" :value="item.username" :label="item.userRealName" :key="index" >
                                </Option>  
                            </Select>
                            <div slot="footer" style="text-align:center;" >
                                <Button type="text" @click="cancel">取消</Button>
                                <Button type="primary" @click="ok">提交</Button>
                            </div>
                        </Modal>


                        <!--合作商详情查看弹窗-->
                        <Modal v-model="userModalVisible" :mask-closable='false' :width="500" :styles="{top: '180px'}">
                            <Table :columns="columnsChannel" :data="dataChannel">
                                <template slot-scope="{ row, index }" slot="status">
                                    <div v-if="row.status === '00'">
                                        <Tag color="success" size="default">启用</Tag>
                                    </div>
                                    <div v-else-if="row.status === '01'">
                                        <Tag color="warning" size="default">审核中</Tag>
                                    </div>
                                    <div v-else-if="row.status === '02'">
                                        <Tag color="default" size="default">草稿</Tag>
                                    </div>
                                    <div v-else-if="row.status === '03'">
                                        <Tag color="warning" size="default">退回</Tag>
                                    </div>
                                    <div v-else-if="row.status === '04'">
                                        <Tag color="error" size="default">拒绝</Tag>
                                    </div>
                                    <div v-else>
                                        <Tag color="error" size="default">停用</Tag>
                                    </div>
                                </template>

                                <template slot-scope="{ row, index }" slot="channelBelong">

                                    <span>{{row.channelBelong=='00' ?"SP":""}}</span>
                                    <span>{{row.channelBelong=='01' ?"直营":""}}</span>
                                    <span>{{row.channelBelong=='02' ?"总对总":""}}</span>

                                </template>


                            </Table>
                            <div slot="footer" style="display: none">
                            </div>
                        </Modal>

                    </Row>

                    <Row class="operation" style="text-align: left">
                        <Button @click="addCommonDealer" type="primary" icon="md-add" v-bind:disabled="!manageRole">新增普通车商</Button>
                        <Button @click="editSalesman" type="primary" icon="md-create" v-bind:disabled="!manageRole">业务员批量修改</Button>
                        <Button @click="disable" icon="md-remove-circle" type="error" v-bind:disabled="!manageRole">批量停用</Button>
                    </Row>

                    <Row>
                        <Table :loading="loading" border :columns="columns" :data="data" sortable="custom"
                               @on-sort-change="changeSort" @on-selection-change="showSelect" ref="selection">

                            <template slot-scope="{ row, index }" slot="cardealerName" >
                                <a style="color: blue;" @click="checkCarDealer(row)">{{row.cardealerName}}</a>
                            </template>


                            <template slot-scope="{ row, index }" slot="channel">
                                    <a @click="getChannelInfo(row)" style="color: blue;">{{row.channelNum}}</a>
                            </template>

                            <template slot-scope="{ row, index }" slot="cooperationMode" >
                                <span>{{row.cooperationMode=="0"?"本地合作":"异地合作"}}</span>
                            </template>

                            <template slot-scope="{ row, index }" slot="location">
                                <span>{{getDetailAddress1(row.locationProvince,row.locationCity)}}</span>
                            </template>

                            <template slot-scope="{ row, index }" slot="address">
                                <span>{{getDetailAddress2(row.channelProvince,row.channelCity,row.address)}}</span>
                            </template>



                            <template slot-scope="{ row, index }" slot="cardealerProperties" >
                                <span>{{row.cardealerProperties=="0"?"汽贸":""}}</span>
                                <span>{{row.cardealerProperties=="1"?"4S":""}}</span>
                                <span>{{row.cardealerProperties=="2"?"其他":""}}</span>
                            </template>

                            <template slot-scope="{ row }" slot="salesMan" >
                                <span>{{getSalemanName(row.salesMan)}}</span>
                            </template>


                            <template slot-scope="{ row,  }" slot="status">
                                <div v-if="row.status == '00'">
                                    <Tag color="success" size="default">启用</Tag>
                                </div>
                                <div v-if="row.status == '01'">
                                    <Tag color="warning" size="default">审核中</Tag>
                                </div>
                                <div v-if="row.status == '02'">
                                    <Tag color="default" size="default">草稿</Tag>
                                </div>
                                <div v-if="row.status == '03'">
                                    <Tag color="warning" size="default">退回</Tag>
                                </div>
                                <div v-if="row.status == '04'">
                                    <Tag color="error" size="default">拒绝</Tag>
                                </div>
                                <div v-if="row.status == '05'">
                                    <Tag color="error" size="default">停用</Tag>
                                </div>
                            </template>


                            <template slot-scope="{ row }" slot="action">
                                <span v-if="row.status=='02' || row.status=='00' || row.status=='05' || row.status=='03'">
                                    <Button style="margin-right:5px" type="primary" size="small" @click="edit(row)" v-bind:disabled="!manageRole" >编辑</Button>
                                </span>
                                <span v-if="row.status!='02' && row.status!='00' && row.status!='05' && row.status!='03'">
                                    <Button disabled style="margin-right:5px" type="primary" size="small" @click="edit(row)">编辑</Button>
                                </span>
                                <span v-if="row.status=='02'">
                                    <Button type="error" size="small" @click="remove(row)" v-bind:disabled="!manageRole">删除</Button>
                                </span>
                                <span v-if="row.status!='02'">
                                    <Button disabled type="error" size="small" @click="remove(row)">删除</Button>
                                </span>
                            </template>

                        </Table>
                    </Row>
                    <Row type="flex" justify="end" class="page">
                        <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
                              @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]"
                              size="small" show-total show-elevator show-sizer></Page>
                    </Row>
                </Card>
            </Col>
        </Row>



    </div>
</template>

<script>
    import {
        getCarDealerData,
        disableCarDealer,
        disableCarDealerFromCase,
        getChannelInfoData,
        deleteCommonCardealerById,
        bulkEditingSalesman,
        bulkEditingSalesmanFromCase,
        getAllSaleManByChannelId,
        getSalemanNameByUsername,
        getAllCardealerName,
    } from "@/projects/afs-channel/api/car-dealer/dealer";
    import circleLoading from "_c/circle-loading/circle-loading.vue";
    import { getLocation } from "@/projects/afs-channel/api/common/common";
    import {province, city, area} from "_p/afs-apply/assets/js/staticData.js";
    import {getCarBrandById,} from  "@/projects/afs-channel/api/dealer/dealer";


    export default {
        name: "carDealer-manage",
        components: {
            circleLoading
        },
        data() {
            const validateName = (rule, value, callback) => {
                var reg = /^[\u4e00-\u9fa5_a-zA-Z]+$/;
                if (!reg.test(value) && value != "") {
                    callback(new Error("人名格式有误!"));
                } else {
                    callback();
                }
            };

            return {
                //查看权限
                checkRole:false,
                //管理权限
                manageRole:false,

                modal1: false,
                saleManName:"",
                loading: false,
                channels:[],
                channelId:[
                    {cardealerId:"",
                    channelId:[]}
        ],
                operationLoading: false,
                drop: false,
                dropDownContent: "更多",
                dropDownIcon: "ios-arrow-down",
                selectCount: 0,
                selectList: [],
                deptId: [],
                selectDep: [],
                department: [],
                province:[],
                city:[],
                location:{
                    locationAddressinfo: [
                        {
                            detailAddress: []
                        }
                    ],
                },
                searchForm: {
                    //合作商账号 目前写死 后面要改************
                    channelId:"",
                    associAccount:"",
                    cardealerName: "",
                    corporateName: "",
                    channelFullName: "",
                    channelBelong: "",
                    salesMan:"",
                    pageNumber: 1,
                    pageSize: 10,
                    startDate: "",
                    endDate: "",
                    status:"",
                },
                editForm:{
                    salesMan:"",
                },
                status:"00",
                selectDate: null,
                userModalVisible: false,
                modalTitle: "",
                columns: [
                    {
                        type: "selection",
                        minWidth: 60,
                        maxWidth:60,
                        align: "center",
                        fixed: "left"
                    },
                    {
                        type: 'index',
                        title:"序号",
                        minWidth: 80,
                        align: "center",
                        fixed: "left"

                    },
                    {
                        title: "车商名称",
                        key: "cardealerName",
                        minWidth: 150,
                        slot: "cardealerName",
                        fixed: "left"
                    },
                    {
                        title: "合作商数量",
                        minWidth: 100,
                        slot: "channel",
                        align: "center",
                    },
                    {
                        title: "所在区域",
                        slot: "location",
                        minWidth: 150,
                        align: "center",
                        //sortable: true
                    },
                    {
                        title: "法人姓名",
                        key: "corporateName",
                        minWidth: 120,
                        align: "center",
                    },
                    {
                        title: "手机号码",
                        key: "telephoneNumber",
                        minWidth: 115,
                        align: "center",
                    },
                    {
                        title: "合作模式",
                        slot: "cooperationMode",
                        minWidth: 130,
                        align: "center",
                    },

                    {
                        title: "车商性质",
                        slot: "cardealerProperties",
                        minWidth: 110,
                        //sortable: true
                        align: "center",

                    },
                    {
                        title: "主营品牌",
                        key: "mainBrand",
                        minWidth: 200,
                        ellipsis:true,
                        render: (h, params) => {
                            return h('div', [
                                h('span', {
                                    style: {
                                        display: 'inline-block',
                                        width: '100%',
                                        overflow: 'hidden',
                                        textOverflow: 'ellipsis',
                                        whiteSpace: 'nowrap'
                                    },
                                    domProps: {
                                        title: params.row.mainBrand
                                    }
                                }, params.row.mainBrand)
                            ])
                        }
                    },
                   /* {
                        title: "业务员",
                        key: "salesMan",
                        minWidth: 100,
                        align: "center",
                        //sortable: true,

                    },*/
                    {
                        title: "注册时间",
                        align: "center",
                        key: "registrationTime",
                        minWidth: 120,
                        //sortable: true,
                    },
                    {
                        title: "统一社会信用代码",
                        key: "socUniCrtCode",
                        minWidth: 200,
                        align: "center",
                        //align: "center",

                    },
                    {
                        title: "注册地址",
                        slot: "address",
                        minWidth: 250,
                        align: "center",
                        //sortable: true,

                    },
                    {
                        title: "状态",
                        slot: "status",
                        minWidth: 120,
                        align: "center",
                        //sortable: true,

                    },
                    {
                        title: "操作",
                        key: "action",
                        minWidth: 140,
                        align: "center",
                        fixed: "right",
                        slot: "action"
                    }

                ],
                data: [],
                cardealerNameData: [],
                columnsChannel: [
                    {
                        title: "名称",
                        key: "channelFullName",
                        align: "center",
                        minWidth: 140,
                    },
                    {
                        title: "渠道归属",
                        slot: "channelBelong",
                        align: "center",
                        minWidth: 60,
                    },
                    {
                        title: "状态",
                        key: "status",
                        align: "center",
                        minWidth: 60,
                        slot: "status"
                    }
                ],
                dataChannel: [],
                total: 0,
                salesManData:[],
                formValidate: {
                    /*corporateName: [
                        {validator: validateName, trigger: "change"}
                    ],
                    salesMan: [
                        {validator: validateName, trigger: "change"}
                    ],*/
                },
            };
        },
        methods: {
            init: function () {
                this.handleSearch();
                this.getProvinceData();
                this.getCityData();
                this.getAllCommonCardealerName();

                let userRoles = this.$store.state.user.roles.toString()
                if (userRoles.indexOf('ROLE_OTHER_NEW_MANAGE_DEALER') > -1 || userRoles.indexOf('ROLE_ADMIN')> -1 || userRoles.indexOf('ROLE_CHANNEL_ADMIN')> -1) {
                    this.manageRole = true;
                }
            },
            changePage(v) {
                this.searchForm.pageNumber = v;
                this.getCarDealerList();
                //this.clearSelectAll();
            },
            changePageSize(v) {
                this.searchForm.pageSize = v;
                this.getCarDealerList();
            },
            clearSelectAll() {
                this.$refs.table.selectAll(false);
            },
            selectDateRange(v) {
                if (v) {
                    this.searchForm.startDate = v[0];
                    this.searchForm.endDate = v[1];
                }
            },

            getCarDealerList() {
                // 多条件搜索车商列表
                //*******登录账户 目前写死*****
                //this.searchForm.channelId="123";
               // this.searchForm.associAccount="888";
                let param ={
                    cardealerName: this.searchForm.cardealerName,
                    corporateName: this.searchForm.corporateName.replace(/\s*!/g,""),
                    channelFullName: this.searchForm.channelFullName.replace(/\s*!/g,""),
                    channelBelong: this.searchForm.channelBelong,
                    salesMan:this.searchForm.salesMan.replace(/\s*/g,""),
                    pageNumber: this.searchForm.pageNumber,
                    pageSize: this.searchForm.pageSize,
                    startDate: this.searchForm.startDate,
                    endDate: this.searchForm.endDate,
                    status:this.searchForm.status,
                }
                this.loading = true;
                getCarDealerData(param).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.data = res.data.records;
                        this.total = res.data.total;
                     /*   this.data.forEach(function (e) {
                            getChannelInfoData(e.id).then(res => {
                                if (res.code === "0000") {
                                    this.channelId.cardealerId=e.id;
                                    this.channelId.channelId=res.data
                                }
                            });
                        });*/
                    }

                });

            },
            getAllCommonCardealerName() {
                getAllCardealerName({cardealerType:"01"}).then(res => {
                    if (res.code === "0000") {
                        this.cardealerNameData = res.data;
                    }
                });
            },



            handleSearch() {
                this.searchForm.pageNumber = 1;
                this.getCarDealerList();
            },

            handleReset() {
                this.$refs.searchForm.resetFields();
                this.selectDate = null;
                this.searchForm.startDate = "";
                this.searchForm.endDate = "";
                this.selectDep = [];
            },
            changeSort(e) {
                this.searchForm.sort = e.key;
                this.searchForm.order = e.order;
                if (e.order === "normal") {
                    this.searchForm.order = "";
                }
                this.getCarDealer();
            },

            addCommonDealer() {
                let params = {
                    type: '1'
                };
                this.afs.newTab(
                    this,
                    'projects/afs-channel/pages/car-dealer/common-car-dealer/commonDealerCheck',
                    '普通车商新增',
                    'ios-add',
                    params,
                    'common-cardealer-add',
                    [],
                    true);
                this.afs.newTab(this,'projects/afs-channel/pages/car-dealer/common-car-dealer/commonDealerCheck','普通车商新增','ios-add',params,'aa',[],true);
            },

            //停用车商
            disable() {
                if (this.selectCount <= 0) {
                    this.$Message.warning("您还未选择要停用的车商");
                    return;
                }
                let status = false;
                this.selectList.forEach(function (e) {
                    if(e.status != '00'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能停用已启用的车商");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认停用",
                    content: "您确认要停用所选的 " + this.selectCount + " 条数据?",
                    onOk: () => {
                        let ids = [];
                        this.selectList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //禁用方法
                        disableCarDealer(ids).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("停用成功");
                                disableCarDealerFromCase(ids).then(res => {
                                    if (res.code === "0000") {
                                        this.$Message.success("停用成功");
                                        this.handleSearch();
                                    }
                                })
                                //    this.clearSelectAll();
                            }
                        });
                    }
                });
            },

            //批量修改业务员
            editSalesman() {
                if (this.selectCount <= 0) {
                    this.$Message.warning("您还未选择要修改的数据");
                    return;
                }
                let status = false;
                const s = new Set();
                this.selectList.forEach(function (e) {
                    if(e.status != '00' && e.status != '05'){
                        status = true;
                    }else{
                        getChannelInfoData(e.id).then(res => {
                            if (res.code === "0000") {
                                res.data.forEach(x => s.add(x.channelId));
                            }
                        });
                    }
                });
                if(status){
                    this.$Message.warning("只能修改停用或已启用的车商的业务员");
                    return;
                }
                setTimeout(() => {
                    if (s.size > 1) {
                        this.$Message.warning("请选择同一合作商下的车商");
                        console.log(s)
                        return;
                    }else{
                        this.modal1=true;
                        let channelId = "";
                        s.forEach((key) => channelId = key )
                        getAllSaleManByChannelId(channelId,"01").then(res => {
                            if (res.code === "0000") {
                                this.salesManData=res.data;
                                /*if(this.salesManData == null || this.salesManData.length == 0){
                                    this.salesManData=[{"username":"admin","userRealName":"该合作商下没有业务员,为了测试保存方便造了个假数据"}];
                                }*/
                            }
                        });
                    }
                }, 600)
            },


            checkCarDealer(v) {
                let channel =[];
                getChannelInfoData(v.id).then(res => {
                    if (res.code === "0000") {
                        channel=res.data
                        let params = {
                            dealerId:v.id,
                            channelFullName:channel[0].channelFullName,
                            channelId:channel[0].channelId,
                            type: '0',
                            status:v.status,
                        };
                        this.afs.newTab(
                            this,
                            'projects/afs-channel/pages/car-dealer/common-car-dealer/commonDealerCheck',
                            '普通车商'+v.cardealerName+"查看",
                            'ios-add',
                            params,
                            'common-cardealer-check'+v.id,
                            [],
                            true);
                    }else{
                        this.$Message.error("未知错误");
                    }
                });
            },

            edit(v) {
                let channel =[];
                getChannelInfoData(v.id).then(res => {
                    if (res.code === "0000") {
                        channel=res.data
                        let params = {
                            dealerId:v.id,
                            channelFullName:channel[0].channelFullName,
                            channelId:channel[0].channelId,
                            type: '2',
                            status: v.status,
                        };
                        this.afs.newTab(
                            this,
                            'projects/afs-channel/pages/car-dealer/common-car-dealer/commonDealerCheck',
                            '普通车商'+v.cardealerName+"修改",
                            'ios-add',
                            params,
                            'common-cardealer-edit'+v.id,
                            [],
                            true);
                    }else{
                        this.$Message.error("未知错误");
                    }
                });
            },
            //根据车商id查询对应的渠道信息
            getChannelInfo(v){
              let id=v.id;
                getChannelInfoData(id).then(res => {
                    if (res.code === "0000") {
                       // this.channels=res.data;
                        this.dataChannel=res.data;
                        this.userModalVisible = true;
                    }
                });
            },

            remove(v) {
                this.$Modal.confirm({
                    title: "确认删除",
                    content: "您确认要删除车商 " + v.cardealerName + " ?",
                    onOk: () => {
                        this.operationLoading = true;
                        deleteCommonCardealerById(v.id).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("删除成功");
                                this.handleSearch();
                            }
                        });
                    }
                });
            },

            dropDown() {
                if (this.drop) {
                    this.dropDownContent = "更多";
                    this.dropDownIcon = "ios-arrow-down";
                } else {
                    this.dropDownContent = "收起";
                    this.dropDownIcon = "ios-arrow-up";
                }
                this.drop = !this.drop;
            },
            showSelect(e) {
                this.selectList = e;
                this.selectCount = e.length;
            },

            ok(){
                let ids = [];
                let ids2 = [];
                this.selectList.forEach(function (e) {
                    ids += e.id + ",";
                    if(e.status=="00"){
                        ids2 += e.id + ",";
                    }
                });
                ids = ids.substring(0, ids.length - 1);
                ids2 = ids2.substring(0, ids2.length - 1);
                //修改方法
                bulkEditingSalesman(this.editForm.salesMan,ids).then(res => {
                    this.operationLoading = false;
                    if (res.code === "0000") {
                        bulkEditingSalesmanFromCase(this.editForm.salesMan,ids2).then(res => {
                            if (res.code === "0000") {
                                this.$Message.success("修改成功");
                                this.handleSearch();
                            }
                        })
                    }
                });
                this.modal1=false;
            },
            cancel(){
                this.modal1=false;
            },

            //反向解析省市地址
            getProvinceData() {
                let param = {level:"1",upperCode: "1"};

                getLocation(param).then(res => {
                    if(res.code === "0000"){
                        this.province=res.data;
                    }
                });
            },
            getCityData() {
                let param = {level:2,upperCode:''};
                getLocation(param).then(res => {
                    if (res.code == "0000") {
                        this.city=res.data;
                    }
                });
            },

            getDetailAddress1(registeredProvince,registeredCity){
                if(registeredProvince!="" && registeredCity!=""){
                    let province="";
                    let city="";
                    for(let i=0;i<this.province.length;i++){
                        if(this.province[i].value==registeredProvince){
                            province=this.province[i].label;
                        }
                    };
                    for(let i=0;i<this.city.length;i++){
                        if(this.city[i].value==registeredCity){
                            city=this.city[i].label;
                        }
                    };
                        return province+city;
                }else{
                    return '';
                }
            },

            getDetailAddress2(registeredProvince,registeredCity,registeredAddress){
                if(registeredProvince!="" && registeredCity!="" && registeredAddress !=""){
                    let province="";
                    let city="";
                    for(let i=0;i<this.province.length;i++){
                        if(this.province[i].value==registeredProvince){
                            province=this.province[i].label;
                        }
                    };
                    for(let i=0;i<this.city.length;i++){
                        if(this.city[i].value==registeredCity){
                            city=this.city[i].label;
                        }
                    };
                        return province+city+registeredAddress;
                }else{
                    return '';
                }
            },
            getSalemanName(id){

            },
        },
        mounted() {
            this.init();
        },
        watch: {
            '$route'(to,from){
                    this.handleReset();
                    this.handleSearch();
            }
        },
    };
</script>
